package com.dkd.manage.mapper;

import com.dkd.manage.annotation.AutoFill;
import com.dkd.manage.constant.OperationType;
import com.dkd.manage.pojo.entity.Channel;
import com.dkd.manage.pojo.vo.ChannelVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ChannelMapper {


    /**
     * 查询货道列表
     * @param innerCode
     * @return
     */
    List<ChannelVo> list(String innerCode);


    /**
     * 新增设备类型
     * @param channel
     * @return
     */
    @AutoFill(OperationType.INSERT)
    Integer add(Channel channel);

    /**
     * 修改设备类型
     * @param channel
     * @return
     */
    @AutoFill(OperationType.UPDATE)
    Integer edit(Channel channel);

    /**
     * 根据id删除设备类型
     * @param ids
     * @return
     */
    Integer deleteChannelById(@Param("ids") Long[] ids);

    /**
     * 根据id查询货道
     * @param id
     * @return
     */
    @Select("select id, channel_code, sku_id, vm_id, inner_code, max_capacity, current_capacity, last_supply_time, " +
            "create_time, update_time, create_by, update_by from tb_channel where id = #{id}")
    Channel getChannelById(Long id);

    /**
     * 批量插入货道
     * @param channelList
     */
    void insertBatch(@Param("channelList") List<Channel> channelList);

    /**
     * 批量修改货道
     * @param channelList
     * @return
     */
    Integer updateBatch(@Param("channelList") List<Channel> channelList);
}
